<?php
error_reporting(E_ALL);
set_time_limit(600);


$key = 'test_key';
$ttl = 3600;


xcache_unset($key);

$val = require dirname(__FILE__). '/xxx_50.php';
//$val = array_slice($val, 0, 5);

xcache_set($key, $val, $ttl);               //数组存储形式
//xcache_set($key, var_export($val, true), $ttl);           //字符存储形式

unset($val);

$processtime = 0;
$processcount = 1;

echo "wait 10 sec\n";
sleep(10);


while($processcount <= 5000){
	$start = microtime(true);
	if(!xcache_get($key)){
		$processcount++;
		echo "NO DATA FOUND";
		break;
	}
	$end = microtime(true);
	$processtime += ($end-$start);

	$processcount++;

}


echo 'PROCESS COUNT:'. ($processcount-1). '. PORCESS ALL TIME:'. $processtime. 's. EACH TIME:'. ($processtime/($processcount-1));